﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using EpiNEXT.Core;
using EpiNEXT.Core.Events;

namespace EpiNEXT.WPF.FormDesigner.Pages
{
    /// <summary>
    /// Interaction logic for Home.xaml
    /// </summary>
    public partial class Home : UserControl
    {
        public event ProjectOpenedHandler ProjectOpened;

        public delegate void ProjectOpenedHandler(object sender, Core.Events.ProjectOpenedEventArgs e);

        public Home()
        {
            InitializeComponent();
        }

        private void btnNewProject_Click(object sender, RoutedEventArgs e)
        {
            //FirstFloor.ModernUI.Windows.Controls.ModernDialog dialog = new FirstFloor.ModernUI.Windows.Controls.ModernDialog();
            //dialog.ShowDialog();
        }

        private void ProjectsSummaryView_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.OriginalSource is Grid)
            {
                Grid grdProject = (e.OriginalSource as Grid);
                object dataContext = grdProject.DataContext;

                if (ProjectOpened != null && dataContext is ProjectInfo)
                {
                    ProjectOpenedEventArgs args = new ProjectOpenedEventArgs(dataContext as ProjectInfo);
                    ProjectOpened(this, args);
                }
            }
        }
    }
}
